package edu.hunau.cxb.security.service.impl;

import edu.hunau.cxb.security.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * @Author: hb
 * @Description:  UserDetailsService根据用户名获取该用户的所有信息,包括用户信息和权限点
 * @Date: 2019-03-26 8:55
 * @Param
 * @return
 **/
@Service
public class UserService implements UserDetailsService {

    @Autowired
    private UserDao userRepository;
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return userRepository.findByUsername(username);
    }
}
